function toggleAccordion(panelId) {
    var panel = document.getElementById(panelId);
    var allPanels = document.querySelectorAll('.accordion-content');

    // Close all panels
    allPanels.forEach(function(p) {
        if (p.id !== panelId) {
            p.style.maxHeight = null;
        }
    });

    // Toggle the current panel
    if (panel.style.maxHeight) {
        panel.style.maxHeight = null;
    } else {
        panel.style.maxHeight = panel.scrollHeight + "px";
    }
}